package com.bw.controller;

import com.bw.bean.User;
import com.bw.bean.Vo;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {

    @Autowired
    VoService voService;

    @RequestMapping("/list1")
    public Map getList1(){
        List<Vo> list = voService.getList1();
        return SugarUtil.getMapData(list);
    }


    @RequestMapping("/list2")
    public Map getList2(){
        Double val = voService.getList2();
        return SugarUtil.getFlipNumberData(val);
    }

    @RequestMapping("/list3")
    public Map getList3(){
        List<User> list = voService.getList3();
        List  list1 = new ArrayList<>();
        list1.add("用户名称");
        list1.add("用户密码");
        list1.add("用户邮箱");
        list1.add("用户性别");
        return SugarUtil.getTablePlayData(list1,list);
    }

}
